PHP Super Counter 1.02 :: Installing and using the script

 

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

 

 

Introduction

Installation

Configuration

Usage

Version history

First off all thank you for downloading this script, before you install this script make sure you have the latest version. This PHP script is freeware. Therefore no guarantee on support or even functionality can be given. However feel free to contact me if you experience problems using this script.

Before you start installing there are a few things you should know:

  • This script requires a MySql backend.
  • This script relies on you to import the tables and their data into your database.
  • The scripts need to know your MySql data to connect.

The first step for using this script is to create the needed tables in your MySql database, for this i have included a file called sc_install.php this file contains the SQL statements to create the needed tables. In order to execute the needed commands, upload this file to your site and execute it. After you have succesfully created the tables and data make sure you remove this script before proceeding.

Alternatly if you are using phpMyAdmin or a simulair product to maintain your database then you can choose to select the file scounter.sql for execution. The tables will then automaticly be created.

If you are updating from version 1.00 you can execute the following SQL statement instead of executing the entire maketables.php file:

CREATE TABLE `SC_STATS` (
`SC_ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
`SC_CODE` TEXT NOT NULL,
`SC_NAME` TEXT NOT NULL,
`SC_YEAR` INT(10) NOT NULL,
`SC_COUNTER` TEXT NOT NULL
);

When the tables are created you need to configure the counter by editing the file sc_config.php:

For the 'host' setting you can usualy suffice with LocalHost, the username and password require valid login credetials for your database. This user must already exist offcourse :) The database name is the name given to your database. (make sure all settings use correct caps.. mypassword is not the same as MyPassword)

$SQL_HOST="HOST";
$SQL_USER="USERNAME";
$SQL_PWD="PASSWORD";
$SQL_DB="DATABASENAME";

The showicon setting is used to display the supercounter icon on the page your counting the hits from. The password settings is used in the clear counter script. (see below) The colors are optional but you can change them. (this is used on the stats page.) The reload delay can be adjusted to count more or less hits from the same ip.

$showicon = true;
$Password = "myclearcounterpassword";
$ReloadDelay = 300;
$TABLE_HEAD_COLOR = "#CCCCCC";
$TABLE_COLOR = "#0099CC";
$TEXT_COLOR = "#000066";

The tablenames are default, if you change these then make sure they reflect the names that you imported into your database!


$SQL_COUNTTABLE="SC_COUNTER";
$SQL_LOGTABLE="SC_LOG";
$SQL_REFERENCETABLE="SC_REFERENCE";
$SQL_BLOCKIPTABLE="SC_BLOCKIPS";
$SQL_STATSTABLE="SC_STATS";

The file sc_clear.php is for resetting the counters, if you dont want this option then dont upload the file. If you do want it then you need to edit the settings in this file. The setting $Password is somthing you can choose yourself to make sure noone can reset your counters without your permission. So set it to a password of your choice before uploading.

Thats it! If you imported the sql script and edited the config file as mentioned then all configuration is done and everything should be ready for usage!
If you are using a static IP address then you can block it from the counter by adding the ip address to the SC_BLOCKIPS table. All IP's entered in that table will be ignored by the counter.

The Super Counter can count for multiple pages at once, it updates the 'global' counter and also the specific page counter. If you want a page to be counted when hit then enter the following line of code into your HTML file:

<?php include "sc_addhit.php"; ?>

This makes the script log the hit and displays the counter icon. (note that the ALT text in the icon gives you information on the counters action taken.

If you wish to display information from the counter on your page then you always need to include the following tag:

<?php include "sc_information.php"; ?>

Once thats done the functions inside the script are available for use, the following information require the following tag:

Information Tag
Total hits on this site <?PHP show_totalhits(); ?>
Total hits to this page <?PHP show_totalhits_currentpage(); ?>
Total hits today <?PHP show_todayhits(); ?>

Total hits this month

<?PHP show_thismonthhits(); ?>
Currently online <?PHP show_currentlyonline();?>

 

More statistics can be found by accessing the page sc_stats.php

If you wish clear the counters (after testing for instance) then you can upload and call the file sc_clear.php

Introduction - Installation - Configuration - Usage - Version history

 

  • Version 1.00 - January 19 2003
    • First release, everything seems to be running smooth...
  • Version 1.01 - January 25 2003
    • Fixed a problem with the month counter where it cleaned up the logfile a bit to good resetting the month counter each day..
    • Added monthly statistics to the stats page
    • Added daily statistics to the daily page.
    • Added a clear counters script.
  • Version 1.02 - January 28 2003
    • Added an installation script for the database tables and data. (Contributed by Ghost)
    • Added a single configuration file for the scripts. (Contributed by Ghost)
    • Fixed a bug in the IP detection.
    • Added the option to configure the ignore delay.
    • Now also hits from the same ip on other pages. (excluded reloads)
  • Version 1.03 - November 12  2005
    • php Super Counter adapted by magtrb.com .
    • fixed many bugs.
    • change the style.
    • add some modifations.
    • remove the ugly pictures.